# Definition for a binary tree node.
class TreeNode:
    def __init__(self, x):
        self.val = x
        self.left = None
        self.right = None

class Solution:
    def binaryTreePaths(self, root: TreeNode):
        if root is None:
            return []
        r = []
        if root.left is None and root.right is None:
            return [str(root.val)]

        if root.left:
            tmp = self.binaryTreePaths(root.left)
            for i in tmp:
                r.append(str(root.val) + '->' + i)
        if root.right:
            tmp = self.binaryTreePaths(root.right)
            for i in tmp:
                r.append(str(root.val) + '->' + i)
        return r

if __name__ == '__main__':
    so = Solution()
    m = 38
    r = so.addDigits(m)
    print(r)
